<ion-header>
  <ion-toolbar>
    <ion-title>{{"filterTitle" | translate}}</ion-title>
    <ion-buttons left>
      <button ion-button icon-left (click)="navBack()">
        <ion-icon class="nav-back" name="arrow-back"></ion-icon>
      </button>
    </ion-buttons>
  </ion-toolbar>
</ion-header>

<ion-content>
  <div padding>
    <ion-segment [(ngModel)]="condition">
      <ion-segment-button value="nurse">{{"nurse" | translate}}</ion-segment-button>
      <ion-segment-button value="building">{{"building" | translate}}</ion-segment-button>
      <ion-segment-button value="level">{{"level" | translate}}</ion-segment-button>
      <ion-segment-button value="room">{{"room" | translate}}</ion-segment-button>
      <ion-segment-button value="person">{{"person" | translate}}</ion-segment-button>
    </ion-segment>
  </div>

  <div [ngSwitch]="condition">
    <ion-list *ngSwitchCase="'nurse'">
      <ion-item *ngFor="let nurse of nurses">
        <ion-label>{{nurse.nurseName}}</ion-label>
        <ion-checkbox [(ngModel)]="nurse.checked"></ion-checkbox>
        <div item-end>{{nurse.departmentName}}</div>
      </ion-item>
    </ion-list>
  </div>

  <div [ngSwitch]="condition">
    <ion-list *ngSwitchCase="'building'">
      <ion-item *ngFor="let building of buildings">
        <ion-label>{{building.buildingName}}</ion-label>
        <ion-checkbox [(ngModel)]="building.checked"></ion-checkbox>
      </ion-item>
    </ion-list>
  </div>

  <div [ngSwitch]="condition">
    <ion-list *ngSwitchCase="'level'">
      <ion-item *ngFor="let level of levels">
        <ion-label>{{level.levelName}}</ion-label>
        <ion-checkbox [(ngModel)]="level.checked"></ion-checkbox>
        <div item-end>{{level.display}}</div>
      </ion-item>
    </ion-list>
  </div>

  <div [ngSwitch]="condition">
    <ion-list *ngSwitchCase="'room'">
      <ion-item *ngFor="let room of rooms">
        <ion-label>{{room.roomName}}</ion-label>
        <ion-checkbox [(ngModel)]="room.checked"></ion-checkbox>
        <div item-end>{{room.display}}</div>
      </ion-item>
    </ion-list>
  </div>

  <div [ngSwitch]="condition">
    <ion-list *ngSwitchCase="'person'">
      <ion-item *ngFor="let person of persons">
        <ion-label>{{person.personName}}</ion-label>
        <ion-checkbox [(ngModel)]="person.checked"></ion-checkbox>
        <div style="font-size: 9px;" item-end>{{getBedString(person)}}</div>
      </ion-item>
    </ion-list>

    <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
      <ion-infinite-scroll-content></ion-infinite-scroll-content>
    </ion-infinite-scroll>
  </div>
</ion-content>
